<?php
header('content-type:text/html;charset=utf8');
$id=$_POST['id'];
$cc=$_POST['cc'];
//var_dump($id,$cc);die;

$link =@mysql_connect('127.0.0.1','root','root');
if(!$link){
    die('连接失败，错误号为：'.mysql_errno().'失败原因：'.mysql_error());
}
mysql_select_db('blog');
mysql_set_charset('utf8');
$sql = "insert into comment(`aid`,`cc`) values('$id','$cc')";
$res = mysql_query($sql) ;
//var_dump($sql);die;
if($res){
    echo '<script>alert("评论成功");window.location.href="/qiantai/single.php"</script>';
}else{
    echo '<script>alert("评论失败");window.location.href="/qiantai/single.php"</script>';
}
mysql_close();
?>